import Vue from 'vue'
import vuexRouterSync from 'vuex-router-sync'

import ElementUI from 'element-ui';

import 'element-ui/lib/theme-default/index.css';

// console debug
// import 'vconsole'

import 'nprogress/nprogress.css';// Progress 进度条 样式
import 'normalize.css/normalize.css';// normalize.css 样式格式化

import '../../less/index/theme/default.less'
import '../../less/index/index.less'
import '../../components/Icon-svg/index'
import '../../assets/iconfont/iconfont'; // iconfont 具体图标见https://github.com/PanJiaChen/vue-element-admin/wiki

import errLog from '../../vuex/index/errLog';// error log组件

import global from '../../plugins/global' //全局插件

import App from './App.vue'

import router from '../../router/index'
import store from '../../vuex/index/index'

import filters from '../../utils/filters'
import directive from '../../utils/directive/index'


// 装载过滤器、directive
Object.keys(filters).forEach(k => Vue.filter(k, filters[k]));
Object.keys(directive).forEach(k => Vue.directive(k, directive[k]));

Vue.use(global);
Vue.use(ElementUI);

vuexRouterSync.sync(store, router);

// 生产环境错误日志
if (process.env === 'production') {
  Vue.config.errorHandler = function(err, vm) {
    console.log(err, window.location.href);
    errLog.pushLog({
      err,
      url: window.location.href,
      vm
    })
  };
}

new Vue(Vue.util.extend({
    router,
    store
}, App)).$mount('#root')




